package com.iee.patterns.example.state.base;

public class Context {
    private static final IState STATE_A = new ConcreteStateA();
    private static final IState STATE_B = new ConcreteStateB();
    // 设置默认状态
    private IState currentState = STATE_A;
    // 用户切换状态
    public void setState(IState state){
        System.out.println("用户切换状态");
        this.currentState = state;
    }
    public void handle(){
        this.currentState.handle();
    }
}
